// src/main.js

import Vue from 'vue'
import App from './App.vue'
import router from './router' // 引入路由配置
import i18n from './lang'
import store from './store' // 引入 store 实例
// 引入eventBus
Vue.prototype.$eventBus = new Vue()

Vue.config.productionTip = false

const setTitle = ( ) => {
  const appName = i18n.t('common.dashboard') 
  
  document.title = appName
}
router.afterEach((to) => {
  setTitle(to)
})
i18n.vm && i18n.vm.$watch('locale', () => setTitle(router.currentRoute))
new Vue({
  i18n,
  store,
  router, // 注入路由
  render: h => h(App)
}).$mount('#app')